import store from "../store";
import axios from "../http";

export async function refreshCarts() {
  let account = JSON.parse(store.state.account);
  console.log("userId" + account.userId);
  await axios.get(`/carts/${account.userId}`).then((res) => {
    console.log(res);
    console.log("刷新购物车");
    let { status, data } = res.data;
    if (status == 0) {
      store.commit("setCartList", data);
    }
  });
}
